package utils

import (
	"crypto/md5"
	"encoding/hex"
	"time"
)

// EncodeMD5 md5 encryption
func EncodeMD5(value string) string {
	m := md5.New()
	m.Write([]byte(value))

	return hex.EncodeToString(m.Sum(nil))
}

func GenerateTimeMD5() string {
	TestString := time.Now().Format("2006-01-02 15:04:05")

	Md5Inst := md5.New()
	Md5Inst.Write([]byte(TestString))
	Result := Md5Inst.Sum([]byte(""))

	return hex.EncodeToString(Result)
}
